package com.example.business.demo.convert;

import com.example.business.demo.dto.DemoDTO;
import com.example.business.demo.entity.DemoEntity;
import org.springframework.beans.BeanUtils;

/**
 * Demo对象转换器
 */
public class DemoConvert {
    
    /**
     * 实体转DTO
     * @param entity 实体对象
     * @return DTO对象
     */
    public static DemoDTO toDTO(DemoEntity entity) {
        if (entity == null) {
            return null;
        }
        DemoDTO dto = new DemoDTO();
        BeanUtils.copyProperties(entity, dto);
        return dto;
    }
}